<?php
function readFRSHTT($data) {
	//000001 = Frost
	//000010 = Rain
	//000100 = Snow
	//001000 = Hail
	//010000 = Thunder
	//100000 = Tornado
	$data = str_pad((int) $data,6,"0",STR_PAD_LEFT);
	//Tornado?
	if($data[0] == '1') echo 'Tornado/Heavy wind<br />';
	//Thunder?
	if($data[1] == '1') echo 'Thunder<br />';
	//Hail?
	if($data[2] == '1') echo 'Hail<br />';
	//Snow?
	if($data[3] == '1') echo 'Snow<br />';
	//Rain?
	if($data[4] == '1') echo 'Rain<br />';
	//Frost?
	if($data[5] == '1') echo 'Frost';
}


function readFRSHTTnoHTML($data) {
	//000001 = Frost
	//000010 = Rain
	//000100 = Snow
	//001000 = Hail
	//010000 = Thunder
	//100000 = Tornado
	$data = str_pad((int) $data,6,"0",STR_PAD_LEFT);
	//Tornado?
	$comma = false;
	if($data[0] == '1') {
		echo 'Tornado/Heavy wind';
		$comma = true;
	}
	//Thunder?
	if($data[1] == '1') {
		if($comma == true) echo ',';
		echo 'Thunder';
		$comma = true;
	}
	//Hail?
	if($data[2] == '1') {
		if($comma == true) echo ',';
		echo 'Hail';
		$comma = true;
	}
	//Snow?
	if($data[3] == '1') {
		if($comma == true) echo ',';
		echo 'Snow';
		$comma = true;
	}
	//Rain?
	if($data[4] == '1') {
		if($comma == true) echo ',';
		echo 'Rain';
		$comma = true;
	}
	//Frost?
	if($data[5] == '1') {
		if($comma == true) echo ',';
		echo 'Frost';
	}
}
?>